package com.yogee.topseller.adapter;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.yogee.topseller.R;
import com.yogee.topseller.activity.PayActivity;
import com.yogee.topseller.activity.ZxActivity;
import com.yogee.topseller.bean.GqczBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 股权出质
 * @auathor ${XiaoJianghong}
 * @date 2017/6/26.
 */

public class GqczDetailAdapter extends RecyclerView.Adapter<GqczDetailAdapter.ItemHolder> {

    private Context context;
    private List<GqczBean.Company> beans = new ArrayList<>();


    private PayActivity.Listener listener;

    public GqczDetailAdapter(Context context) {
        this.context = context;
    }

    public void addData(List<GqczBean.Company> beans) {
        this.beans = beans;
        notifyDataSetChanged();
    }

    public void setListener(PayActivity.Listener listener){
        this.listener = listener;
    }

    @Override
    public ItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_xzcf_item, parent, false);
        return new ItemHolder(view);
    }

    @Override
    public void onBindViewHolder(ItemHolder holder, final int position) {
        if(position==0)
            holder.view_line.setVisibility(View.GONE);
        else
            holder.view_line.setVisibility(View.VISIBLE);
        holder.tv_title.setText(beans.get(position).getName());

    }

    @Override
    public int getItemCount() {
        return beans == null ? 0 : beans.size();
    }

    class ItemHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.view_line)
        View view_line;
        @BindView(R.id.tv_title)
        TextView tv_title;

        public ItemHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }


}